﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;

namespace SZ.Mech
{
    public class CompProperties_GnomonGroup : CompProperties
    {
        public CompProperties_GnomonGroup()
        {
            this.compClass = typeof(CompGnomonGroup);
        }
    }

    public class CompGnomonGroup : ThingComp
    {
        public override void CompTickRare()
        {
            base.CompTickRare();
            Pawn pawn = (this.parent as Pawn);
            if (pawn != null && pawn.Map != null)
            {

                List<Pawn> pawns = pawn.Map.mapPawns.PawnsInFaction(pawn.Faction);
                foreach (var mechanoid in pawns)
                {
                    if (mechanoid.RaceProps.IsMechanoid)
                    {
                        if (!mechanoid.health.hediffSet.HasHediff(SZ_DefOf.SZ_Gnomon))
                        {
                            HediffGnomon hediffGnomon = (HediffGnomon)mechanoid.health.AddHediff(SZ_DefOf.SZ_Gnomon);
                            hediffGnomon.owner = pawn;
                        }
                    }
                }
            }
        }

        public override void CompTickLong()
        {
            base.CompTickLong();
            //if (Pawn.IsHashIntervalTick(250))
            //{


            // }
        }
    }
}